<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Object</title>
    <!--引入Vue-->
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<div class="root">
    <h1>欢迎来到{{name}}峡谷</h1><br>
    <button v-on:click="showInfo">点我提示信息</button>
    <button @click="showInfo">点我也可以提示信息</button>
    <br>
    <button @click="clk1">点我不传参</button>
    <button @click="clk2(66,$event)">点我传参传事件</button>
</div>
</body>

<script type="text/javascript">
    const vm = new Vue({
        el:'.root',
        data:{
            name:'召唤师'
        },
        methods:{
            // 如果在method里面写箭头函数，this就不是vue对象本身了，普通函数是的
            showInfo(e){
                console.log(e)
                console.log(this) //vue对象
                alert("全军出击!!!")
            },
            clk1(e){
                alert("全军出击!!!")
            },
            clk2(number,e){
                alert("全军出击!!!"+number)
                console.log(e)
            },
        }
    })
</script>
</html>
